package com.boot.springboot.component.helper.bean;

import com.boot.springboot.component.helper.service.BiInfoHelper;
import com.boot.springboot.component.helper.service.BiInfoHelper2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;

/**
 * InitializingBean接口为bean提供了初始化方法的方式，它只包括afterPropertiesSet方法，凡是继承该接口的类，在初始化bean的时候会执行该方法。
 *
 * @author luowenjie
 * @since 2021/12/17 17:27
 */
@Component
@Slf4j
public class BiInfoWatch implements InitializingBean {

    @Autowired
    BiInfoHelper helper;

    @Autowired
    BiInfoHelper2 helper2;

    @Override
    public void afterPropertiesSet() throws Exception {
        HashMap<String, String> biInfoHashMap = new HashMap<>();
        biInfoHashMap.put("111","222");
        helper.setBiInfoMap(biInfoHashMap);
        helper2.setBiInfoMap(biInfoHashMap);
    }

}
